Yes, but both visas require you to follow specific procedures. For TN visa holders, a new TN application must be submitted for the new position. H-1B visa holders must have their new employer file a new H-1B petition on their behalf.