It's not necessarily cruel to keep an animal in captivity or teach it to do tricks.
Dogs are a good example. If I released a pet dog into the wild it would be cruel.
Same goes with any animal that has only known captivity all it's life.
Dogs are not a good example, really. Some animals do better in captivity while others do not. For example, apparently great white sharks are terrible in captivity. Animals that have been domesticated are very different to forcing tigers, lions, elephants, orcas, and dolphins to do tricks.
But for animals that do well in captivity, I see no reason why they shouldn't be- especially if it helps conservationism. There are zoos that really should be shut down though. I've been to some pretty sad and depressing ones that really shouldn't have any animals.