In leading two iconic companies that are restructuring and potentially face challenges in the coming years, the CEOs of General Electric (GE 5.68%) and Lowe's  (LOW -0.82%) certainly have their work cut out for them. Comparing the two might seem academic, but it reveals a lot about the task ahead for both, so let's take a look at which stock is a better buy.

Lowe's margin woes

Like so many other parts of the retail world, the biggest structural challenge facing Lowe's is the threat of online competition eating into its revenue. It's easy to dismiss the threat due to the notion that home improvement stores sell bulky items and DIY customers often need help when buying products. However, Lowe's own online sales rose 16% in the first quarter, and its rival The Home Depot (HD -1.00%) increased its online sales by 23% in the same period. As such, there's little doubt that e-commerce is highly useful for selling home improvement products.

A collection of DIY tools.

Image source: Getty Images.

As ever with such situations, it's a good idea to follow gross margin -- a figure representing the percentage of what's left from revenue after the cost of goods is taken out. As you can see in the charts below, Lowe's has underperformed its rival in recent years -- a sign of a lack of pricing power.

Moreover, the spread between Home Depot's and Lowe's operating margins has become wider and wider since the last recession, particularly as Home Depot has done a much better job in cutting sales, general, and administrative (SG&A) costs in the period.

LOW Gross Profit Margin (TTM) Chart

LOW Gross Profit Margin (TTM) data by YCharts

The case for Lowe's

The investment thesis for Lowe's probably accepts that gross margin will be under continued pressure, but the company's aim should be for CEO Marvin Ellison to successfully execute his turnaround plans and get margins back to something close to Home Depot's.

Indeed, as the former vice president of Home Depot's U.S. stores from 2008-2014 (a period when Home Depot pulled away from Lowe's in terms of margins), it's a job Ellison should be well suited to do. It's a compelling case, especially given that Home Depot currently has three times the market cap of Lowe's -- meaning that Lowe's stock could appreciate substantially if it gets close to Home Depot's margin.

Unfortunately, the scorecard on the matter isn't great so far, and the market was disappointed by Lowe's gross-margin decline in the first quarter -- 31.5%, compared with 33.1% in the same period last year. Ellison said that earnings in the most recent quarter were impacted by "the convergence of cost pressure, a significant transition in our merchandising organization, and ineffective legacy pricing tools and processes led to gross margin contraction" 

On a brighter note, he also said gross margin performance would improve through the year. We shall see. 

General Electric's big challenge

It's no secret that the power segment is at the front and center of the company's problems. Outside of power, the aviation segment remains strong. Investors can look forward to years of revenue and cash flow generation from products and services -- not least from the legacy CFM56 engine (in the Boeing 737 and Airbus A320 family) and the LEAP engine (in the Boeing 737 MAX and Airbus A320neo).

Meanwhile, healthcare remains a business that CEO Larry Culp believes is a "low to mid single-digit grower over time, and should continue to accrete margins."

All of which leaves the ailing power segment as the swing factor in GE's earnings. The problem here may turn out to be structural, since the falling cost of renewable energy and of storing it makes generating electricity from gas relatively less attractive. That's a problem when GE Power's core products are gas turbines. In fact, the market for heavy-duty gas turbines has halved in the last five years.

That said, it's far from clear that renewable energy is inexplicably going to take over from gas in electricity production -- either in the U.S. or globally. The projected cost savings from using renewable energy aren't that much, and renewable takes up significantly more landmass to generate the same amount of energy. It also creates significant political resistance due to creating eyesores on the countryside. Moreover, the use of gas to produce electricity has actually been rising in the last 18 months in the U.S.

There's also finally some evidence that the power segment is beginning to stabilize. GE has raised its full-year guidance for adjusted industrial free cash flow to a range of a loss of $1 billion on the low end to a gain of $1 billion on the high end; that is up from a previous range of a loss of $2 billion to zero. The change in outlook is largely on the back of improved execution at power.

Which is the better buy

Cautious investors will avoid both stocks, and wait for some evidence of a turnaround before considering either. That said, if forced to choose, I would take Lowe's based on the idea that Home Depot has set a series of standards that the company can aim for, even if online competition puts a ceiling on long-term margin growth.

In comparison, it's far from clear whether GE's problems are structural, and/or whether investors will want to see some margin expansion at GE Power before feeling fully confident in the turnaround plan.