Yes, 'it' is acceptable in both sentences. In both cases 'it' is a personal pronoun that can only refer to 'water' in the first sentence and 'dog' in the second.
One of the most common problems with substituting a noun with a personal pronoun is not to make it clear which noun your pronoun is replacing:
If you heat water in a jug to 100 degrees Celsius, it boils.
In this case it is not clear if 'it' refers to the jug or to the water.
One way to avoid this problem is to ensure that the personal pronoun that you use is situated as close as possible to the noun that is its antecedent. In your first sentence, 'it' is closest to the two nouns 'degrees' and 'Celsius'. However, neither of these is capable of boiling, so 'it' obviously refers to the next closest noun, which is 'water'.
In your second sentence the closest noun to 'it' is 'dog', so there is no possibility of not understanding that 'it' refers to 'dog'.