Typically when you buy a desktop computer it comes with a large 3.5″ hard drive in it and when you buy a laptop it comes with a small 2.5″ hard drive.
If a laptop breaks down, you can remove its hard drive and connect it in an enclosure similar to the one pictured above, then you can use that to transfer the data to the new computer.
However, if your desktop computer breaks down, you need to use an enclosure with an external power supply.
The process of removing the hard drive is often easier than laptops, but it needs an extra power socket to power it.
PATA vs SATA
If your computer is older than 10 years, then it may come with a PATA (Parallel Advanced Technology Adapter) previously known as IDE (Integrated Drive Electronics), these need a special type of enclosure, and the transfer speed is greatly reduced (because they rely on USB 2.0 instead of the newer enclosures that use the much faster USB 3.0)
To make things worse, the laptop hard drives of this age have a smaller connector that makes them incompatible with the desktop hard drive enclosure unless you get an adapter.
Newer hard drives use a SATA (Serial Advanced Technology Adapter) which is a much smaller and faster connector, up-to 12 times faster than PATA. Additionally, the sane connector is used on both desktop and laptop hard drives.
You can plug a laptop hard drive into a desktop enclosure and it will work just as well as if it were plugged into a laptop enclosure, but the opposite isn’t possible (because it needs external power.
SSD
SATA SSDs always come in laptop sized form factor and you can use an adapter to securely mount a laptop sized SSD into a desktop computer.
The reason is mainly that the market demands smaller computers, so laptop sized SSDs are the way forward.
NVMe enclosures are also available, especially if you have to replace your internal NVMe drive with a bigger one, an enclosure enables you to transfer files from it using USB.