As a complement to the other answers, here is an equivalent circuit with which you should be able to work out whether your component can handle the dissipated power, be it a TO-220 or any other package, with or without a heat sink.
simulate this circuit – Schematic created using CircuitLab
If the voltage source is bothering you when solving for the junction temperature ("voltage"), you can remove it and work on the temperature elevation with respect to the ambient temperature (GND is now Ambient temperature/potential).
- R1, R2 and C1 come from the component datasheet
- R3 comes from the datasheet of the thermal paste used if any, or from charts of thermal resistance VS contact pressure (depends on contact area) for the materials in contact
- R4 and C2 come from the heat sink datasheet, R4 should depend on the airflow.
Generally, "case" means tab if there is one (the actual case otherwise), but otherwise you should be able to tweak the equivalent circuit accordingly - just think about the resistors as paths for the heat, and you get the temperature of an element from its voltage.
For steady state, assume the thermal capacitors are removed (fully "charged"/heated up). For example, without heat sink:
When the dissipated power is switched fast compared to the thermal time constants, you generally have to multiply the specific capacitance that the manufacturers may give (rule of thumb is 3 (W.s)/(K.kg)) with the associated mass to get the capacities, and deal with usual RC charges.
Note that the ambient temperature around the component may be much higher than the ambient temperature around you, if the air is not circulating and/or if it is enclosed. For this reason, and because all the values are generally not very accurate, be critical about T0 and take at least a safety factor or 1.5 (as above) or preferrably 2 on T1.
Finally, you might want to consider looking at the plots VS junction temperature on the component datasheet and changing the max temperature for a lower one, as an OK-ish temperature might ruin your circuit's performance, still. In particular, temperature cycling reduces your component's lifetime - a rule of thumb is the lifetime halves for every 10°C increment.