As for the other way it is easy, you create the Matrix and get the rotate Quat, (return matrix.getRotate()), something like:
osg::Matrixd Utils::createMatrix(double x, double y, double z, double h, double p, double r)
{
osg::Matrixd mxR;
mxR.makeRotate(osg::DegreesToRadians(r),osg::Vec3(0,1,0));
osg::Matrixd mxP;
mxP.makeRotate(osg::DegreesToRadians(p),osg::Vec3(1,0,0));
osg::Matrixd mxH;
mxH.makeRotate(osg::DegreesToRadians(h),osg::Vec3(0,0,1));
osg::Matrixd mxT;
mxT.makeTranslate(osg::Vec3(x,y,z));
return (mxP*mxH*mxT*mxR);
}