Are anxiety and depression the result of not praying hard enough?
This is a complicated and loaded question. First, we know that much of depression and anxiety stems from what we expect out of life. How we view happiness influences the way we look at life decisions and how we see everything. It becomes our purpose and identity in life. Prayer can help us order our happiness to more enduring, pervasive and profound happiness, lessening the impact of depression and anxiety.
Prayer consists in raising the mind and heart to God, and perfect happiness consists in seeing God face to face. We all have the natural inclination to pray as our desires are restless until they rest in God, says, St. Augustine, "our hearts are restless until they rest in you." Prayer may help with a person who struggles with confirmation bias. It may lead a person to see where God has been good to them instead of dwelling on all that is bad. Prayer can help a person orient his faculties to supernatural truths, which are goods in which we all cannot help but desire. Prayer can help lead one to live a more virtuous life, which has a direct impact on our mental health. Prayer can help lead a person out of a fixation of self and other created goods that are put over universal goods; again, a significant influence on one's mental health. Prayer will help break one from these attachments. The Eastern religions understand this but their answer was to put off all desire. The Catholic and Christian understanding is that we can have all that we desire in a more perfect way, if only they are ordered properly. That is where prayer comes in; it helps us see things in their proper order.
It is for this reason therapist and parents should encourage prayer and spiritual reading. No sane therapist would say anxiety and depression are the results of a less spiritual life. But no sane therapist would discourage prayer as a means to mental health.