As far at they match the exact same voltage values and the same or bigger current they are similar from the laptop point of view.
You say that its from an HP laptop, but take care in case its not original since cheap adapters may lack several protections, and that may damage the laptop.
With that said, check if the tips are the same. In case they aren't you may have to do some soldering to replace the tip.
As a side note: In case your laptop specifies how many wattage it needs in the bottom label,you may calculate the minimum current of the AC adapter with the formula wattage/19.5 = minimum current. Give it some margin to ensure.