بسم الله الرحمن الرحيم
Yes, it is permissible. However, it is better if you close the window while offering salah or hang some curtain or raise the wall of graveyard in front of the mosque high so that no grave is seen from there.
Allah knows Best!
Darul Uloom Deoband
This answer was collected from the official ifta website of Darul Uloom Deoband in India.