Learning Safety Constraints from Demonstrations with Unknown Rewards