Poincar\'e gauge invariance of general relativity and Einstein-Cartan theory