If the anxiety or the depression are caused by "physical" reasons, like, lack of some hormone and so on....you have to treat that going to the doctor and maybe, using medication.
BUT, the majority of cases are induced by the world we live in, and the system we live in. Listen to how many "we have too's" we come across during our lives. "You have to be succesful, you have to be smart, you have to have a family and kids, you have to grow your status and reputation, people need to like you, me me me me me I I I I I..."....everything is propaganda and induced since you are born, so, if you are anxious you become veeery anxious and depressed, and if you are not, you receive a lot of invitations, and depending on how you see you and life, you become depressed.
There is a lot of ego and self centeredness involved too. When you look at thw world and understand what it is, and how impermanent things are (including you) and how much suffering people endure.....and the opposite too, which is: art, poetry, nature, beauty, love, compassion....there are a lot to enjoy and learn here....after seeing all that depression becomes bearable, and you deal with your mind telling you incoherent shit.