Waltham-based Boston Dynamics said it has made the "extremely difficult decision" to lay off 5% of its workforce.