The two things are not exactly the same, however.
If you feel better after a mid-winter break in a sunny place, maybe it is because the mid-winter break in a sunny place or a few hours outside do good, and you should do that.
Staying in a non-sunny environment indoors and taking vitamin D might (or might not) provide the same wellness.
I guess it is the same thing with meal substitutes, maybe (though I doubt it) we have arrived to a point where we could take a single pill or gulp a dose of some (possibly terribly tasting) high-tech mush containing all that is needed, but maybe sitting at a table, making a pause for half an hour, eating some good tasting food, sniffing its aroma, etc. are the things that actually do the good.
I'm not able to look up studies for this right now so I'm just going by my own experience and other anecdotal reports, but it's a kind of circular dependency that intrigues me.
Yet there are other factors which make going out into the sunshine pleasant. UV light causes nitric oxide to be released from the skin, relaxing the blood vessels. Also I think just seeing brightly lit outside objects and moving about feel good. It's a different world and 'a change is as good as a rest'.
Taking a mid-winter break to someplace sunny gives a distinct feeling if physical wellness and energy.
Denying that vitamin D is important seems silly when people who are indoors so often feel remarkably better after spending even just a few hours outside in the sun.