Select Spaces ⇒ Tabs in the Lines submenu of the Convert menu to convert as many spaces into tab characters as possible, without changing the layout of the file. 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 the settings for tab stops at specific columns, elastic tabbing, or tab-separated values into account. For best results, those should all be unused or turned off.