Depression, all depression, occurs consequently from the mind's misidentification of self.
Subconsciously misidentifying one's essential self/center/ego with any particular concept disposes the mind to be happy when the concept is present and sad when it is absent.
Depression is a signal that a now-absent concept has been previously subconsciously misidentified as being part of one's essential self/center/ego. The stronger the misidentification the stronger the depression. If the absent concept has been misidentified as being a significant portion of the self, then a significant portion of the self is now missing, producing a sense of significant loss and sadness.
One can simply realize that this has occurred, and thus attach no real importance to the depression. Or one can further seek to find the particular misidentification that has produced the current depression, so that one can cease such misidentification. And one can further place oneself on alert for any future incipient misidentifications that may start to occur, and erase them before they ever become established. Or even, one can begin/continue one's own personal investigation/awareness/understanding of what the essence of one's personal self/center/ego really is.
A conclusion of such a serious investigation with a realization that such things are merely culturally induced mental constructs of no intense importance, eliminates future depressions. The stronger the realization the stronger the elimination.
Out-of-control seemingly totally biochemical depressions are not much different; they have both a physical component and a psychological component. The physical component, the periodic mental events occurring amidst vast lack of mental control, are no different than any other type of intense pain, in that eventually they too pass away, if only the center/self/ego would step aside and let it. The psychological component, usually fear, is handled as above.