Comparative ab initio study of the structural, electronic, magnetic, and dynamical properties of LiOsO3 and NaOsO3