Depression is historically associated with events resulting in the loss of someone cared for; which jeopardizes reproduction, hence since depression is a negative feeling, it has an evolutionary advantage. The many causes of depression are incidental, and largly wouldn't exist with higher society, which wouldn't exist without language, which was a random mutation only a couple hundred thousand years ago, where depression was already fully developed, as it is in many higher organisms.