Select Indentation Spaces ⇒ Tabs in the Lines submenu of the Convert menu to convert as many spaces at the start of each line into tab characters as possible, without changing the layout of the file. Spaces that occur after a non-whitespace character on a line are not converted. This command only has its desired effect when using a monospaced font or text layout. If you select some text first then only the selected lines are converted. If there is no selection then this conversion affects the entire file.
The conversion uses the tab size that you specified on the Tabbing page in the file type configuration. It does not take tab stops at specific columns into account. The settings for elastic tab stops and tab-separated values don’t matter because they don’t affect tabs used for indentation.