Each environment has its own advantages and disadvantages.
It will depend on the circumstances that force you to work in each and how you make the best out of every situation.
Working from home is less formal and you get to avoid the tedious office politics that could you slow you down. On the other hand, you might not have the support system that comes with working side by side with your colleagues.
Working from home often suits people who are introverts and certain professions such as programming while extroverts and professions such as outdoor offline marketers and sales representatives would feel caged while working from home.