So the thing about depression is that there are a lot of different things that could cause it. In some cases, marijuana consumption, usually low-level regular consumption, seems to alleviate depression and even social anxiety (despite marijuana's ostensibly anxiogenic effects); in others it may be of no benefit. My understanding is that doctors like to prescribe marijuana to treat depression in those patients where a benefit is seen mostly because it seems to be safer, cheaper, and to have fewer side effects than other available antidepressants.