The 2 commands are somewhat related but are quite different. If you want a switch port to operate as a trunk then the most important required command is switchport mode trunk. After defining the port as a trunk there are other commands that you might use.
switchport trunk encapsulation dot1q is an optional command that defines the encapsulation type of this trunk. dot1q is the default encapsulation type and the other type is isl. It has been a very long time since I have seen a switch configured to use isl, so the command to set encapsulation type is not used very frequently in live environments.
When a switch port is configured as a trunk, by default all vlans are carried on the trunk. If you want to specify that only certain vlans are to be carried on this trunk you would use the command switchport trunk allowed vlan.