Does VBoxManage convertfromraw --format VDI process unallocated space?

Convertfromraw has no idea what sectors the guest OS uses or doesn't use, so the virtual image will contain the entire source disk. In fact the source file can be anything - it doesn't even have to be a disk image.

The only space optimization is that large chunks (>1MB) that are filled with zero bytes will merely be flagged as zero and not written to the target file. This is a simple form of lossless compression, perhaps resembling simplified run-length encoding.

This is the same mechanism that causes VDI files to get smaller if you zerofill/sdelete and then clone them.

To minimize the size of the VDI file, you should therefore zero all the unused sectors on the source disk before doing convertfromraw. Defragmenting (if possible) all used sectors to the beginning of the disk will also help.