This question asked by you, has been researched for decades in the past by psychiatrists and the good news here is that finally there has been some success in this regard.
Depression is caused by both genetic and environmental factors. Some of the environmental causes of depression are
==> Stress : There appears to be a complex relationship among stressful situations, our mind and body's reaction to stress, and the onset of clinical depression.
==> Traumatic events : Many times, people who become depressed report that a single traumatic event happened just prior to their becoming depressed.
==> Childhood difficulties : People who become clinically depressed have generally experienced more severe difficulties in childhood than those who do not become depressed.
It was also proposed that there are several genetic factors involved in its cause.To confirm the presence of genetic factors, scientists conducted various studies on twins. Identical twins share 100% of their genes, while non-identical twins share 50% of their genes.If genes are part of the cause, we expect a patient’s identical twin to have a much higher risk of disease than a patient’s non-identical twin. It has been found that when one identical twin becomes depressed the other will also develop clinical depression approximately 76% of the time. When identical twins are raised apart from each other, they will both become depressed about 67% of the time. It was also found out that the incidence of both non identical twins becoming depressed was only 17%, hence these studies confirm that depression has a strong genetic factor.
Research on the heredity of depression within families also shows that if you have a parent or sibling that has had major depression, you may be 1.5 to 3 times more likely to develop the condition than those who do not have a close relative with the condition. A British research team recently isolated a gene that appears to be prevalent in multiple family members with depression. The chromosome 3p25-26 was found in more than 800 families with recurrent depression.
Hence to answer your question we can say that genes are one of the factors that contribute to depression, in more simple words the genetic factor increases the predisposition of an individual to develop depression in coordination with environmental stress.