Image source: Whole Foods.

The grocery industry has changed dramatically in recent decades, and both Whole Foods Market (WFM) and Wal-Mart (WMT -1.75%) have sought to make their impressions on the industry in very different ways. Whole Foods helped popularize natural and organic foods, and it rode that trend to big share-price gains for a long time to capitalize on changing consumer attitudes toward food. Meanwhile, Wal-Mart aimed to give shoppers a reason to come to its stores more frequently, and its value approach has been a disruptive force in the grocery industry generally. Now that both companies are fighting for growth, investors want to know which one is the better buy. Let's take a closer look at Whole Foods and Wal-Mart, comparing them on a number of metrics to see which one looks more attractive right now.

Valuation and stock performance

Whole Foods and Wal-Mart have seen their stocks move in opposite directions over the past year, as they each navigate their challenges. Wal-Mart has eked out a 4.5% gain since July 2015, but Whole Foods is down 16% over the same period.

Even though Wal-Mart has held up better than its natural food specialist rival, the massive retailer still retains more attractive valuations based on simple earnings metrics. Looking at earnings over the past 12 months, Whole Foods carries a trailing earnings multiple of 23, and that's quite a bit higher than Wal-Mart's corresponding figure of 16. Some might argue that Whole Foods' prospects for immediate earnings growth are better than Wal-Mart's, but even when you look at future earnings expectations, the disparity remains. Wal-Mart's forward earnings multiple of 17 is well below the 21 times forward earnings at which Whole Foods shares trade. Wal-Mart has the edge over Whole Foods in terms of valuation.

Dividends

When it comes to dividends, Wal-Mart once again has a clear edge. When you look at dividend yields for the two companies, Wal-Mart weighs in at 3%. That's almost double the 1.6% dividend yield that Whole Foods pays.

Moreover, a look at dividend growth shows Wal-Mart's long-term commitment to dividends. The department store retailer boasts a 43-year streak of raising its dividend each and every year, with its most recent increase having come in March. Not all of Wal-Mart's annual increases are huge, but since 2008, its quarterly payments have more than doubled.

Image source: Wal-Mart.

By contrast, Whole Foods has been much less consistent with its dividends. Steady growth over the long run continued until the financial crisis of 2008, at which time Whole Foods took a hiatus of about two and a half years from making dividend payments at all. Since restoring its payout in 2011, Whole Foods has more than doubled what it pays, but some might question whether they can count on the natural foods specialist in tough times in the future. Wal-Mart gives investors more confidence on the dividend front.

Growth prospects and risks

Big companies like Wal-Mart and Whole Foods can find it difficult to grow, but both companies are trying hard. Wal-Mart has seen some signs of life as it goes through a multi-year attempt to turn around its business, which in the past dealt with falling customer traffic and diminishing demand. Higher wages and investments in technology and productivity have been costly, but they've also started to show signs of producing better sales growth. Comps have risen for seven straight quarters at Wal-Mart, but to offset some of the new costs it has incurred, the retailer really needs to see growth accelerate in the quarters to come. One key could be its e-commerce efforts, because if it can win back more of its business from online competitors, the resulting sales gains could be monumental.

Lately, Whole Foods has struggled. The grocery saw a 3% drop in comparable store sales in its most recent quarter, which was worse sequentially from what it had seen earlier in the year. On the top line, sales climbed just over 1% since the same quarter in the previous year, and profit fell 10%. Extensive buybacks helped keep earnings per share flat, and it will take strong success from the expansion of its 365 store concept to restore optimism about the company's prospects. If Whole Foods can get younger customers into its 365 stores, then it might reverse the downward trajectory the stock has seen lately. Yet a turnaround will take time to play out, and expected comparable-store sales declines this year of 2% or more are discouraging.

Whole Foods and Wal-Mart have both had to deal with challenges in the overall retail industry, but right now, Wal-Mart looks like the better buy. Both companies are in the middle of long-term plans to reinvigorate their businesses, but Wal-Mart has already seen greater signs of success, and the valuation and dividend advantages that it has make its stock look more attractive than Whole Foods right now.