UniHOPE: A Unified Approach for Hand-Only and Hand-Object Pose Estimation