I answer your question for APA. Psychological papers are very rigidly formatted, so possibly you have more leeway when following MLA, but I would suspect that the basics still apply.
To answer your question, we must first understand what the purpose of the headings is. To understand that, let's take a step back and look at the paper's title.
The APA Manual says that
A title should summarize the main idea of the manuscript simply and, if possible, with style. It should be a concise statement of the main topic and should identify the variables and theoretical issues under investigation and the relationship between them. An example of a good title is "Effect of Transformed Letters on Reading Speed."
A title should be fully explanatory when standing alone. Although its principal function is to inform the reader about the study, a title is also used as a statement of article content for abstracting and reference purposes in databases such as APA's PsycINFO. A good title is easily shortened to the running head used within the published article. (APA, 2009, p. 23)
As an article in the APA Style Blog explains, a title should not be a question:
A great title gives away the ending. If your title is in the form of a yes–no question, try rephrasing it so that the question is answered or the answer at least alluded to. This primes the reader for deeper comprehension. If Philip K. Dick had written for an academic audience, you might be perusing Androids Dream of Electric Sheep: Empathy in Nonhuman Species before bed tonight. (http://blog.apastyle.org/apastyle/2010/07/five-steps-to-a-great-title.html)
Why does the title of an academic paper have to "give away the ending"? Let's take another step back and look at the purpose of academic writing.
Academic writing, while it certainly profits from being entertaining, has the main purpose of transporting information. Throughout the APA Manual the basic requirement for academic writing is emphasized repeatedly, for example in the title of chapter 3: Writing Clearly and Concisely.
The prime objective of scientific reporting is clear communication. You can achieve this by presenting ideas in an orderly manner and by expressing yourself smoothly and precisely.
Now, if we want to understand what makes a good section heading, we only have to think of the heading as the title to that section and keep in mind the basic purpose of academic writing.
Most academics have to read several articles each day, besides doing their research, writing their own papers, holding classes, correcting student work, and taking care of administration. For that reason, exerimental papers in the natural sciences all have the same structure, and the main sections usually all have the same headings: Introduction, Methods, Results, Discussion. For most natural scientists writing up their experimental findings, your question of phrasing a section heading as a question cannot arise, because the headings are predefined.
But even if you deviate from this dogmatic style, your headings still have the purpose of organizing your communication and identifying structural elements:
In scientific writing, sound organizational structure is the key to clear, precise, and logical communication. This includes the use of headings to effectively organzie the ideas within a study as well as seriation to highlight important items within sections. Concise headings help the reader anticipate key points and track the development of your argument.
Taking all this together, if you wrote your paper according to APA stlye, your
section headings must not be phrased as questions.
But "Why Eating Vegetables is Important" is not a good section heading either, because it does not "give away the ending". A good section heading might be something like:
Vegetables protect the body from oxidant stress
a good section heading will be the answer to the question.