This is a classical control problem. You want to create a feedback loop that takes the divergence from optimal position and applies the appropriate torque to nudge it back into position. 

    btQuaternion targetOrientation  = // whatever you need
    btQuaternion currentOrientation = myObject->getOrientation();
    

Getting the delta orientation is quite simple, you need to find the ["difference" between two the quaternions](https://stackoverflow.com/questions/1755631/difference-between-two-quaternions) target and current orientation. 

    btQuaternion deltaOrientation = targetOrientation *  currentOrientation.inverse();

Unfortunately this quaterion does not say much about any divergence that we can use.
But if you convert this delta orientation [into euler angles](http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=4&t=1711).

    btVector3 deltaEuler = QuaternionToEulerXYZ(deltaOrientation );

You basically get the scaled inverse of the torque you want to apply. Now you "just" need to find an appropriate amount to ease it in.

The simple solution is to multiply it with a factor. You may need to play around with the factor until you find a good value. You may also want to look into a [PID-Controller](https://en.wikipedia.org/wiki/PID_controller) to get a smoother more responsive easing.