Can the phrase "be necessary to" only be used on people?
Your teacher is most likely incorrect.
Old Counterexamples
Some high-profile examples, though dated and not a model for modern grammar, counter the idea that be necessary to may only refer to people.
The Second Amendment of the U.S. Constitution (source):
A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed.
Thomas Paine in Age of Reason (source):
But it is necessary to the happiness of man, that he be mentally faithful to himself.
John Locke in A Letter concerning Toleration (source):
Those moral rules which are necessary to the preservation of civil society [. . .].
New Counterexamples
I did a search of COCA for necessary to the [N*]
to obtain the following examples. This is not an exhaustive list.
Recent examples include Bloomsbury, Freud, and the Vulgar Passions (1990):
The monetary reforms necessary to the preservation of reasonable price stability are also necessary to the preservation of civilization.
Intermental Thought in the Novel: The Middlemarch Mind (2005):
The physical brain is necessary to the production of a mind [. . .].
"Radical Islam in America" USA Today (2005):
To the contrary, preventing this is necessary to the defense of religious freedom.
American Heritage (2004):
The abdominal operation is necessary to the health of the patient [. . .].
Meet The Press (Spoken) (2011):
Debate that is absolutely necessary to the future of this country in terms of entitlements [. . .].
Microsoft–hardly a paragon of the English language–has an error in Windows 7:
The Selected Disk Is Necessary to the Operation of Your Computer, and May Not Be Cleaned
Examples of the teacher's claim
A COCA search provides a few hits between 1990 and 2010 (source):
He was thinking, from his care in formulating his words, which was more necessary to him with her than it had been with anyone.
What would be more meaningful than being necessary to him in a practical sense [. . .].
She wanted to become so necessary to him that he wouldn't leave her.
She was both intelligent and necessary to him.
I am not so necessary to him as he is to me.
Even if Gorbachev's history was, and still is, necessary to him, it is clearly out of style with many of his successors [. . .].
Note: this only looks at "necessary to him"; further searches with her, them, person names, etc. may yield more examples.
Conclusion
In the OP's case it does sound better to replace to with for; however, the sentences above sound fine to me. My intuitive guess is that the phrase be necessary to (excluding to-infinitives, e.g. "it is necessary to kill") is less common than be necessary for, but I lack evidence to back up that claim. Nevertheless, the teacher's claim doesn't seem founded on real-world usage.
I think there is something wrong with your sentence, in that I myself could not use necessary to in that way. It would have to be necessary for, at least if it were me saying it. I would have to say:
- Healthy fats are necessary for our overall well-being.
Here are some examples from the OED:
- It was necessary to have a variety.
- Is is necessary to declare your imported goods.
- I prepared all things necessary for my journey.
- Change and alternation are necessary for the mind as well as for the body.
I can’t quite put my finger on it, but your use of necessary to there strikes me as old-fashioned. I am not saying your teacher is right, mind you; there seems to be something left out.