I think of melancholy and depression as similar, but maybe not exactly the same. Melancholy is a type of sadness, but still an emotional state. Depression (at least as psychologists use the word) is more encompassing. As depression worsens, feelings go from sad to just empty.
As someone who is naturally often melancholy and/or depressed, I can attest that there is definitely a physical factor at work. I am genetically prone to depression, apparently, as my mother and several other relatives also experience it. But my depression is more severe than theirs, which I believe is because I was raised in an adoptive home where anxiety of all sorts was constant. My early married years were extremely stressful also. Extended periods of high stress cause elevated cortisol and adrenaline levels which seem to "break" something in one's biochemistry. Now, my life is relatively low in stress, but I still get depressed without medication. Of course, all the other things one does to be mentally healthy still matter as well.
I think the thermostat analogy is a good one, Roberta, except we are less uniform than a thermostat. I may have a range from 0 to 5, and yours may range from 3 to 10. So I can be (and am) much happier and less melancholy than I used to be -- but I'll never be as consistently upbeat as you are. It will be interesting one day to find out just how much of that is a result of our particular physical bodies, and how much is part of our individual innate nature.