How can depression and fear be effectively managed in people who know they will die soon? Are there any efficient ways to overcome the fear and depression before death  (supposing you know you are going to die soon) ?
I'm no expert on imminent death handling but I have some concepts to share. My suggestions are general suggestions that don't only apply for this scenario but that can be applied more generally, including that scenario.

Overcoming fear of death already is not easy, having to do it in an expedited fashion is even more challenging. 

Fear of death comes from resistance to it, there are a lot of books that teach how to surrender to it to drop all resistance and the fear of death with it. 

I would recommend reading about "impermanence" in Buddhism, the "dying before you die" concept, "the power of now", "spiritual enlightenment". 

Those family of books on "spiritual enlightenment" and "power of now" teach you how to surrender and not resist to things you can't control.