The datasheet says the IC can handle 150C maximum and the power has a thermal resistance of 40C/W from silicon junction to ambient without a heatsink (it heats up by this much for every watt dissipated as heat). 40C/W is a typical unheatsinked value for a power package on a regular PCB without any special heat pads.
-That means we have an extra 150C-25C = 125C of headroom that we can heat up the IC by before exceeding the maximum temperature.
-if the IC heats up by 40C/W, that means that we can dissipate 125C/40C/w = 3.125W before exceeding the maximum junction temperature AT ROOM TEMPERATURE. If the room temperature is higher, then we can't dissipate as much heat since we have less temperature headroom.
You pick a worst case ambient temperature and the maximum junction temperature you are willing to tolerate (usually with at least some margin below the maximum rated on the datasheet) and calculate how much power you can dissipate like I Just did. Then you look at the losses in the IC and calculate how much current it can actually pass.
Continuing with my room temperature example, the datasheet says the worst case switch on-resistance is 340mohms. I'm going to assume 100% duty cycle operation as worse case (may or may not be true or even possible depending on your application or even the type of switching converter you are working with). THere are also losses from switching and since I don't know them I will just assume they are equal to the resistive losses. So I'm going to use a switch resistance of 680mohms. I neglect all other power dissipated because it's usually very small relative to the power switch.
3.125W = I^2*Rdson = (680mohms)*I^2
I = 4.6A maximum that can be allowed to pass through the switch.
For a buck converter, the highest switch current is equal to the highest output current (since buck converters make a lower voltage from a higher voltage. Conservation of energy means the input current is lower than the output current, thus making output current the maximum in the circuit). For a boost converter it is the highest input current.