There's not enough information to say.
For example, if both companies had a billion dollar loan, Company A will be in a lot of trouble if profits decline whereas Company B would still have room to maneuver.
Similarly, management styles will matter a lot more than simply net profit. If management is trying to cook the numbers to look better than they are, instead of focusing on innovation and/or cost control, the same profit today may be vastly different tomorrow. Likewise, if they misjudge the industry they are in, and either embark on bad projects or don't consider good ones, then it could affect the company's performance in the future. None of that can be captured by net profit alone, and in general you should never boil down an investment decision down to a single variable.
You also can't compare companies directly that way if they span different industries. For example, a 20% margin might be terrible for the fashion industry but amazing for a utility, and 4% margin might be amazing for a nail manufacturer but terrible for a software company. So the more applicable comparison would be, what are the profit margins of other companies in the same industry, and how does this one compare? The first might be making 20% in an industry that typically makes 50%, and the second might be making 4% in an industry that typically makes 2%.
Other things to consider are ROE and ROTA, how much of an asset base does the company have, compared to the money it's generating? All of that will determine the financial stability of the company, and also gives an idea of how efficient the companies are at using their assets: What if Company A has an asset base of $1 Billion and Company B has an asset base of $500 Million, then Company A is barely making money off its assets while Company B is generating it's own assets worth of revenue in a year. Definitely things to consider as well.
All in all, there's a danger in making investment decisions off of a simple accounting ratio like that, executives are well aware of lots of ways to distort the numbers (if they are doing that it's a huge warning sign but you need more information to know!), and it may mean different things to different industries at different times. So, if you're trying to compare two companies, make sure you're using the right measuring sticks, and by all means use more than one!